package cn.highedu.spring.config;

import cn.highedu.spring.bean13.Foo;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.util.ArrayDeque;
import java.util.Queue;

@Configuration
@ComponentScan("cn.highedu.spring.bean13")
public class Application5Config {

    @Bean
    public DataSource dataSource() {
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        return dataSource;
    }

    @Bean
    public Queue ack(){
        Queue queue = new ArrayDeque();
        queue.add("1");
        queue.add("2");
        return queue;
    }

    @Bean
    public Queue ack2(){
        Queue queue = new ArrayDeque();
        queue.add("3");
        queue.add("4");
        return queue;
    }

    @Bean
    public Foo foo1(){
        return new Foo();
    }

    @Bean
    public Foo foo2(){
        return new Foo();
    }

    @Bean
    public Foo foo3(){
        return new Foo();
    }
}
